﻿using System;
using System.IO;
using SourcesUnPacker;

namespace ReadMoonSource
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            string filePath = @"D:\role\idx\1.bytes";
            
            using (FileStream fs = new FileStream(filePath, FileMode.Open))
            {
                using (BinaryReader reader = new BinaryReader(fs))
                {

                    var role=  RoleData.read(reader);
                    test(role);        
                }
            }

        }


        public static void test(RoleData role)
        {
           var anim=  role.GetRoleAnimationData(EAnimationType.Idle, Dir.Down);
            
           Console.WriteLine("Frames: " + string.Join(",", anim.Frames));
           for (int z = 0; z < anim.Frames.Length; z++)
           {
               //打印下所有的图片
              var frames=  role.frames[anim.Frames[z]];
              Console.WriteLine("===================start frame "+anim.Frames[z]+"=========================");
              for (int i = 0; i < frames.images.Length; i++)
              {
                  //打印images
                  for (int j = 0; j < frames.images[i].Length; j++)
                  {
                      var image = frames.images[i][j];
                      System.Console.WriteLine(image.ToString());
                  }
              }
              Console.WriteLine("=================== end  frame "+anim.Frames[z]+"=========================");
            
           }
        }
    }
}